using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows.Forms;
using Microsoft.VisualStudio.DebuggerVisualizers;

namespace GuavaData
{
    /// <summary>
    /// A Visualizer for SomeType.  
    /// </summary>
    public class GTreeVisualizer : DialogDebuggerVisualizer
    {
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            GTree data = (GTree)objectProvider.GetObject();

            using (GTreeVisualizerForm displayForm = new GTreeVisualizerForm(data))
            {
                windowService.ShowDialog(displayForm);
            }
        }

        /// <summary>
        /// Tests the visualizer by hosting it outside of the debugger.
        /// </summary>
        /// <param name="objectToVisualize">The object to display in the visualizer.</param>
        public static void TestShowVisualizer(object objectToVisualize)
        {
            VisualizerDevelopmentHost visualizerHost = new VisualizerDevelopmentHost(objectToVisualize, typeof(GTreeVisualizer));
            visualizerHost.ShowVisualizer();
        }
    }
}